<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // function createObj(o){
        //     function F(){}
        //     F.prototype = o
        //     return new F();
        // }
        // 是ES5 Object.create的模拟实现
        // 缺点：
        // 包含引用类型的属性值始终都会共享相应的值，和原型链继承的缺点一样。

       var person = {
           name:"ykk",
           color:["red","yellow"]
       }
       let p1 = Object.create(person)
       let p2 = Object.create(person)
       p1.name = "YQQ"
       console.log(p1.name)
       console.log(p2.name)
       p1.color.push("plum")
       console.log(p1.color,p2.color)




















    </script>
</body>
</html>